//
//  LanguageSelectCell.m
//  Lightthings
//
//  Created by 王岩 on 2024/12/5.
//

#import "LanguageSelectCell.h"
#import "TitleModel.h"

@interface LanguageSelectCell ()
@property (weak, nonatomic) UILabel *titleLab;
@property (weak, nonatomic) UIImageView *arrowView;
@end

@implementation LanguageSelectCell

- (UILabel *)titleLab {
    if (!_titleLab) {
        UILabel *obj = [UILabel new];
        [self addSubview:_titleLab = obj];
        [obj mas_makeConstraints:^(MASConstraintMaker *make) {
            kMakeLV(12);
            kMakeRV(-12);
            kMakeCenterYV(0);
        }];
        obj.font = U_bfont(16);
        obj.textColor = KLColor(@"#000000");
        self.klBottomLine.hidden = NO;
        [self arrowView];
    }
    return _titleLab;
}

- (UIImageView *)arrowView {
    if (!_arrowView) {
        UIImageView *obj = [UIImageView new];
        [self.contentView addSubview:_arrowView = obj];
        [obj mas_makeConstraints:^(MASConstraintMaker *make) {
            kMakeWHV(25, 25);
            kMakeRV(-17);
            kMakeCenterYV(0);
        }];
        obj.image = U_imageNamed(@"item_language_unselect_icon");
    }
    return _arrowView;
}

- (void)setModel:(TitleModel *)model {

        [super setModel:model];
       
        self.titleLab.text = model.title?:@"";
        self.titleLab.textAlignment = model.textAlignment;
     
     
  
        if ([model.value boolValue]) {
            self.arrowView.image = U_imageNamed(@"item_language_selected_icon");
        }else {
            self.arrowView.image = U_imageNamed(@"item_language_unselect_icon");
        }

}



@end
